home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
science
/
mndlbrtm.sit
/
MandelbrotMS.rsrc
/
øFm4_132_Mandelbrot (MS)
< prev
Wrap
Text File
|
1991-02-07
|
2KB
|
30 lines
------------------------------ Mandelbrot (MS) ------------------------------
This EDP computes images of the Mandlbrot Set using the Mariani-Silver algorithm.
This algorithm is based on the assumption that a rectangle in the complex plane,
whose outline is all the same colour, must be entirely of that colour. It then becomes
possible to colour the interior of the rectangle without calculating its pixels.
This algorithm is not guaranteed to give correct images of the Mandelbrot Set - that
is, the assumption above is not generally true when the complex plane is only
sampled in a discrete fashion - but you will find that it works nicely all the same.
The implementation works as follows:
Ñ To colour a rectangle, scan the center point and all four corners. Then scan all the
edges. If any sampled pixel has a different colour than the center one, split the
rectangle into four equal parts and retry the procedure on each quarter separately.
Ñ If a rectangle's outline and center point all have the same pixel value, fill the
rectangle entirely with this colour.
Ñ If a rectangle that is less than 5 pixels wide or high is encountered in this
procedure, calculate all its pixels individually (do not recurse further).
Ñ Before calculating a pixel value (that is, applying the z := z^2 + c iteration to it),
check the pixel map to see if it has been calculated already. Unknown pixels are
recognized by their value (0); if a pixel has been calculated, it has a value ranging
from 1 to 255.
Ñ The iteration routine is written in assembly language for maximum speed, as is the
rectangle fill routine. According to the required accuracy, fixed or floating point
calculation modes are used, as in the standard "MBFast" EDP.
Ñ Because the algorithm must be able to get information from the pixel map, to see
whether a pixel has already been calculated, black and white operation is not
supported. In a bitmap, each pixel can have only two different values, so you could
only generate solid black images, since white has a special meaning.
Ñ Apart from the only-colour restriction, this EDP is used exactly like MBFast.